Trò chơi Tic-Tac-Toe, game đánh caro full source code
2 // <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
3 // <remarks>ChatClient is the main class of this api.</remarks>
4 // <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
5 // ----------------------------------------------------------------------------------------------------------------------
6
7 namespace ExitGames.Client.Photon.Chat
8 {
9 using System.Collections.Generic;
10
11 /// <summary>
12 /// A channel of communication in Photon Chat, updated by ChatClient and provided as READ ONLY.
13 /// </summary>
14 /// <remarks>
15 /// Contains messages and senders to use (read!) and display by your GUI.
16
17 /// Access these by:
18 /// ChatClient.PublicChannels
19 /// ChatClient.PrivateChannels
20 /// </remarks>
21 public class ChatChannel
22 {
23 /// <summary>Name of the channel (used to subscribe and unsubscribe).</summary>
24 public readonly string Name;
25
26 /// <summary>Senders of messages in chronoligical order. Senders and Messages refer to each other by index. Senders[x] is the sender of Messages[x].</summary>
27 public readonly List<string> Senders = new List<string>();
28
29 /// <summary>Messages in chronoligical order. Senders and Messages refer to each other by index. Senders[x] is the sender of Messages[x].</summary>
30 public readonly List<object> Messages = new List<object>();
31
32 /// <summary>Is this a private 1:1 channel?</summary>
33 public bool IsPrivate { get; internal protected set; }
34
35 /// <summary>Count of messages this client still buffers/knows for this channel.</summary>
36 public int MessageCount { get { return this.Messages.Count; } }
37
38
39 /// <summary>Used internally to create new channels. This does NOT create a channel on the server! Use ChatClient.Subscribe.</summary>
40 public ChatChannel(string name)
41 {
42 this.Name = name;
43 }
44
45 /// <summary>Used internally to add messages to this channel.</summary>
46 public void Add(string sender, object message)
47 {
48 this.Senders.Add(sender);
49 this.Messages.Add(message);
50 }
51
52 /// <summary>Used internally to add messages to this channel.</summary>
53 public void Add(string[] senders, object[] messages)
54 {
55 this.Senders.AddRange(senders);
56 this.Messages.AddRange(messages);
57 }
58
59 /// <summary>Clear the local cache of messages currently stored. This frees memory but doesn't affect the server.</summary>
60 public void ClearMessages()
61 {
62 this.Senders.Clear();
63 this.Messages.Clear();
64 }
65 }
66 }
----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------
A channel of communication in Photon Chat, updated by ChatClient and provided as READ ONLY.
Contains messages and senders to use (read!) and display by your GUI.
Access these by:
ChatClient.PublicChannels
ChatClient.PrivateChannels